package com.stu.exercise.utils;

import org.mindrot.jbcrypt.BCrypt;

public class BCryptUtil {

    // 加密密码
    public static String encrypt(String rawPassword) {
        return BCrypt.hashpw(rawPassword, BCrypt.gensalt());
    }

    // 验证密码
    public static boolean matches(String rawPassword, String hashedPassword) {
        return BCrypt.checkpw(rawPassword, hashedPassword);
    }
}

